文章目录
  1. 1. git 取得tag的对应的代码

git 取得tag的对应的代码

git tag

先 git clone 整个仓库,然后 git checkout tag_name 就可以取得 tag 对应的代码了。

但是这时候 git 可能会提示你当前处于一个“detached HEAD” 状态,因为 tag 相当于是一个快照,是不能更改它的代码的,如果要在 tag 代码的基础上做修改,你需要一个分支:

?

1 git checkout -b branch_name tag_name

这样会从 tag 创建一个分支,然后就和普通的 git 操作一样了。

获取指定版本的代码

  1. git checkout b0362a895d39061c0bc6f05c575af47de1b3f702

  

如果想要从repostory里直接获取到指定版本的副本,并将指定版本拉为分支,目前只能这样做:

  1. git clone url
  2. git checkout -b newBranch fc558def
  3. git push origin newBranch
文章目录
  1. 1. git 取得tag的对应的代码